{include file=header.html}
<script type="text/javascript" language="javascript" src="{lib file=jquery-1.6.3.min.js}"></script>
<script language="javascript" type="text/javascript" src="{lib file=jquery.ui/jquery.ui.js}"></script>
<script language="javascript" type="text/javascript" src="{res file=js/jquery.funkyUI.js}"></script>
<script language="javascript" type="text/javascript" src="{lib file=jquery.plugins/jquery.validate.js}"></script>
<script language="javascript" type="text/javascript" src="{res file=js/common.js}"></script>
<style type="text/css">
input {
	vertical-align: -5px;_vertical-align: -1px;margin-right: 5px
}
</style>
<script type="text/javascript">
$(function(){
	$("#merch_assign #parent_arr").click(function(){
		var _this=$(this);
		var m_name=_this.attr('m_name');
		if($('#merch_assign .checkall_'+m_name).is(':checked')){
			$('.checkitem_parent_'+m_name).attr('checked','checked');
		}else{
			$('.checkitem_parent_'+m_name).removeAttr('checked');
		}
	});
	$("#merch_assign #next_arr").click(function(){
		var _this=$(this);
		var m_name=_this.attr('m_name');
		if($('#merch_assign .checkall_'+m_name).is(':checked')){
			$('.checkitem_child_'+m_name).attr('checked','checked');
		}else{
			$('.checkitem_child_'+m_name).removeAttr('checked');
		}
	});
});
</script>
<body>
<div class="sub-body">
<div class="tab-frame" style="width:900px;">
<div class="tab-title-1">
<span>{$lang.assign_merch_demand}</span>
</div>
<form id="assignform" action="" method="post">
	<table width="100%" cellspacing="0" cellpadding="0" class="tab-display">
		<tr>
                <th align="right">
                    {$lang.sel_merch}:&nbsp;&nbsp;</th>
                <td align="left">
                <div id="merch_assign">
					<!-- {foreach from=$all_merch item=merchs} -->
					<input type="checkbox" m_name="{$merchs.fabric_type_name}" id="parent_arr" class="checkall_{$merchs.fabric_type_name}" />{$merchs.fabric_type_name}
					<div style="margin-left: 40px;">
					<!-- {foreach from=$merchs.merch_user item=next_merch name=ct} -->
						<input class="checkitem_parent_{$merchs.fabric_type_name}" name="assign_merchant_id[]" type="checkbox" value="{$next_merch.user_id}" <!-- {if in_array($next_merch.user_id,explode(',',$assign_merchant))} -->checked="checked"<!-- {/if} --> />&nbsp;{$next_merch.fabric_shop_name}&nbsp;
						<!-- {if ($smarty.foreach.ct.iteration)%10==0} -->
						<br/>
						<!-- {/if} -->
					<!-- {/foreach} -->
					</div>
					<div style="margin-left: 20px;">
					<!-- {foreach from=$merchs.child_type item=next_type name=nt} -->
						<input type="checkbox" m_name="{$next_type.fabric_type_name}" id="next_arr" class="checkall_{$next_type.fabric_type_name}" />&nbsp;{$next_type.fabric_type_name}&nbsp;
						<!-- {if ($smarty.foreach.nt.iteration)%10==0} -->
						<br/>
						<!-- {/if} -->
						<div style="margin-left: 20px;">
						<!-- {foreach from=$next_type.last_merch item=lasts name=lt} -->
							<input class="checkitem_child_{$next_type.fabric_type_name}" name="assign_merchant_id[]" type="checkbox" value="{$lasts.user_id}" <!-- {if in_array($lasts.user_id,explode(',',$assign_merchant))} -->checked="checked"<!-- {/if} --> />&nbsp;{$lasts.fabric_shop_name}&nbsp;
							<!-- {if ($smarty.foreach.lt.iteration)%10==0} -->
							<br/>
							<!-- {/if} -->
						<!-- {/foreach} -->
						</div>
						<hr/>
					<!-- {/foreach} -->
					</div>
					<hr/>
					<!-- {/foreach} -->
				</div>
				</td>
        </tr>
        <tr>
            <th></th>
            <td align="left">
                <input class="btn-2" type="submit" name="Submit" value="{$lang.submit}" />&nbsp;&nbsp;
                <input class="btn-2" type="reset" name="reset" value="{$lang.reset}" />
                <input type="button" class="btn-2" value="返回" onclick="history.back();" /></td>
        </tr>
	</table>
</form>
</div>
</div>
</body>
</html>